package com.downguys.result;

import java.util.HashMap;

/**
 * 返回结果
 *
 * @author xiyang.qiao
 * @date 2017/1/3 - 17:16
 */
public class ReturnResult extends BaseResult{


    /***
     * 成功响应码.
     */
    public static final int SUCCESS_CODE = 0;

    /***
     * 成功消息
     */
    public static final String SUCCESS_MSG="success";

    /**
     *
     */
    private static final long serialVersionUID = 4563041585656640951L;


    public ReturnResult() {
        super();
        this.code = SUCCESS_CODE;
        this.msg = SUCCESS_MSG;
    }

    protected Object result;

    public Object getResult() {
        return result;
    }

    public ReturnResult setResult(Object result) {
        this.code = SUCCESS_CODE;
        this.msg = SUCCESS_MSG;
        this.result = result;
        return this;
    }

    public ReturnResult setResult(String key, Object value) {
        this.code = SUCCESS_CODE;
        this.msg = SUCCESS_MSG;
        HashMap<String, Object> returnMap = new HashMap<>(1);
        returnMap.put(key, value);
        this.result = returnMap;
        return this;
    }

}
